import 'package:flutter/material.dart';
// import 'package:flutter_app/res/listData.dart';

class TabBarPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text("左右切换"),
          ),
          body: LayoutDemo()),
    );
  }
}

class LayoutDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 3,
        child: Scaffold(
            appBar: AppBar(
                backgroundColor: Colors.grey,
                toolbarHeight: 35,
                elevation: 0,
                title: Row(
                  // mainAxisSize: MainAxisSize.max,
                  // mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Expanded(
                      child: Container(
                        // height: 30,
                        margin: EdgeInsets.all(0),
                        padding: EdgeInsets.all(30),
                        decoration: BoxDecoration(
                            color: Colors.white,
                            border: Border.all(
                              width: 1,
                              color: Colors.green
                            )
                           ),
                        // padding: const EdgeInsets.only(left: 20),
                        child: TabBar(
                          labelColor: Colors.white,
                          ///未选中
                          unselectedLabelColor: Colors.green,
                          // unselectedLabelStyle:TextStyle(decorationStyle:TextDecorationStyle.dotted ),
                          // indicator: Decoration.lerp(, b, t),
                          ////指示器的颜色等各种设置
                          indicator:  BoxDecoration(
                            color: Colors.green,  
                          // border: Border.all(
                          //   width: 1,
                          //   color:Colors.white, 
                          // )
                          ),

                          ///指示器长短
                          indicatorSize: TabBarIndicatorSize.tab,
                          overlayColor: MaterialStateProperty.all(Colors.red),
                          tabs: <Widget>[
                          //  Container(
                          //    decoration: BoxDecoration(
                          //      border: Border.all(
                          //       //  color: Colors.white
                          //      )
                          //    ),
                          //    child: Tab(text: "左边"),
                          //  ),
                            Tab(text: "待我评教"),
                            Tab(text: "我已评教"),
                            Tab(text: "我未评教"),
                          ],
                        ),
                      ),
                    ),
                  ],
                )),
            body: TabBarView(
              children: <Widget>[
                ListView(
                  children: <Widget>[
                    ListTile(title: Text("内容一")),
                    ListTile(
                      title: Text("内容一"),
                    )
                  ],
                ),
                ListView(
                  children: <Widget>[
                    ListTile(title: Text("内容二")),
                    ListTile(
                      title: Text("内容二"),
                    )
                  ],
                ),
                ListView(
                  children: <Widget>[
                    ListTile(title: Text("内容一")),
                    ListTile(
                      title: Text("内容一"),
                    )
                  ],
                ),
              ],
            )));
  }
}
